package com.huawei.appmarket.service.launcher;

import android.content.Context;
import android.content.Intent;
import androidx.annotation.NonNull;
import com.huawei.appgallery.foundation.launcher.api.AbsLaunchInterceptor;
import o.Logger;

public class AppDefaultInterceptor extends AbsLaunchInterceptor {
    public boolean isInterceptor(@NonNull String str) {
        return true;
    }

    public Intent getIntentByPackage(Context context, String str) {
        if (context == null) {
            Logger.ˋ("AppLauncher", "context is null error,launchDefaultIntent for launching package:[" + str + "]");
            return null;
        }
        Intent launchIntentForPackage = context.getPackageManager().getLaunchIntentForPackage(str);
        if (launchIntentForPackage == null) {
            Logger.ˋ("AppLauncher", "launchDefaultIntent for launching package:[" + str + "] failed.intent is null.");
            return null;
        }
        launchIntentForPackage.addCategory("android.intent.category.LAUNCHER");
        return launchIntentForPackage;
    }
}
